/*!
 * Circular Buffer Example
 * Take it from http://en.wikipedia.org/wiki/Circular_buffer
 */

#include "contiki-conf.h"
#include "collect-view.h"

/* Circular Buffer Types */


typedef struct {
    uint32_t time_seconds;
    uint8_t seqno;
    uint8_t for_alignment;
    struct collect_view_data_msg msg;
  } msg_to_sink;

typedef struct
{
   uint8_t writePointer; /* write pointer */
   uint8_t readPointer;  /* read pointer */
   uint8_t size;         /* size of circular buffer */
   uint8_t count;         /* number of items in the buffer*/
   msg_to_sink keys[0];      /* Element of circular buffer */
} CircularBuffer;

/* Init Circular Buffer */
CircularBuffer* CircularBufferInit(CircularBuffer** pQue, int size);

int CircularBufferEnque(CircularBuffer* que, msg_to_sink k);

int CircularBufferDeque(CircularBuffer* que, msg_to_sink* pK);

